<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
  <head>
    <title></title>   
    <base href="<%=basePath%>">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0"> 
	<%@ include file="/common/importJsCss.jsp" %>
 	<script type="text/javascript" id="preJavascript">
$(function(){
	//myFailState.nut mySuccssState.nut
	amplify.request.define( "decoderSingleExample", "ajax", {
    	url: "amplifySuccssState.nut",
    	type: "GET",
    	dataType: "json",
    	decoder: function ( data, status, xhr, success, error ) {
        	if ( data.status === "success" ) {
            	success( data.data );
        	} else if ( data.status === "fail" || data.status === "error" ) {
            	error( data.message, data.status );
        	} else {
            	error( data.message , "fatal" );
        	}
    	}
	});
			
	amplify.request({
    	resourceId: "decoderSingleExample",
    	success: function( data ) {
        	out("success",$.toJSON(data));
    	},
    	error: function( message, level ) {
        	out(message,level);
    	}
	});
});
	</script>
  </head>  
  <body>
	<div class="container">
        <div class="page-header">
            <h2>返回数据,decoder不分离</h2>
        </div>
<pre class="prettyprint linenums"></pre>
    </div>	
  </body>
</html>
